package com.vast.ui.component.models;

import java.util.ArrayList;
import java.util.List;

import org.eclipse.core.runtime.ListenerList;

public class IoPanel {
	private List<Io> ioList;
	private ListenerList listenerList;
	
	public IoPanel() {
		ioList      = new ArrayList<Io>();
		listenerList = new ListenerList();
	}
	
	public List<Io> getList(){
		return ioList;
	}
	
	public void add(Io io){
		ioList.add(io);
		Object[] listeners = listenerList.getListeners();
		for (Object listener : listeners) {
			((IoListener) listener).add(io);
		}
	}
	
	public void remove(Io io){
		ioList.remove(io);
		Object[] listeners = listenerList.getListeners();
		for (Object listener : listeners) {
			((IoListener) listener).remove(io);
		}
	}
	
	public void addListener(IoListener listener){
		listenerList.add(listener);
	}
	
	public void removeListener(IoListener listener){
		listenerList.remove(listener);
	}
	
}
